import { createApp } from 'vue';

import { createRouter , createWebHistory } from 'vue-router' ;

import App from '@/App.vue' ;
import Book from '@/components/Book.vue' ;
import Course from '@/components/Course.vue' ;

const app = createApp(App);

const options = {
    routes: [
        { path: '/' , name: 'root' , redirect: '/book' },
        { path: '/book' , name: 'book' , component: Book } ,
        { path: '/course' , name: 'course' , component: Course } ,
    ] ,
    history: createWebHistory()
}
const router = createRouter( options );

app.use( router );

const vm = app.mount( '#app' ) ;

console.log( 'root component: ' , vm );

// 挂载 5 秒后，应用将被卸载
// setTimeout( () => app.unmount() , 5000 );
